Ext.define('Holo.controller.ManagerUser', {
    extend: 'Ext.app.Controller',
	
    views: [
        'ManagerUser',
        'user.FormUserDesc'
    ],
    
    stores: [
        'Users'
    ],
    
    
    refs: [
        {
	   selector: 'updateuserdesc',
	   ref: 'formUserDesc'
	}      
    ],


    
    init: function() {
    	 this.control({
        
            'updateuserdesc': {
                afterrender : function(cmp){
		   var form = this.getFormUserDesc();
                   form.child('textfield[name=name]').setValue(GlobalData.currentUser.get('name'));
                }
            },
            
            'updateuserdesc button[action=updateuserdesc]': {
                click : this.submitFormUserDesc
                
            },
        
        });
    },
    

    /**
     *
     */
    submitFormUserDesc : function(){
        ///var newDescriptionData = this.getFormAddLabel().getValues();
        var userData = this.getFormUserDesc().getValues();
	GlobalData.currentUser.set('name', userData.name);
	GlobalData.currentUser.commit(true);
        //console.log('commit');
        
    }
    
    
 });